package biz.studentDiy;

import java.util.Collection;

import models.Choose;
import models.Student;
import utils.TransactionTemplate;
import dao.ChooseDao;
import dao.ChooseDaoHbnImpl;
import dao.StudentDao;
import dao.StudentDaoHbnImpl;

public class StudentDiyBizImpl implements StudentDiyBiz {
	private ChooseDao chooseDao=new ChooseDaoHbnImpl();
	private StudentDao stuDao=new StudentDaoHbnImpl();
	@Override
	public Collection<Choose> getAllChooseByStuId(Long stuId) {
		Collection<Choose> chooses=null;
		try {
			TransactionTemplate.beginTransaction();
			chooses=chooseDao.selAllChoose(stuId);
			TransactionTemplate.commit();
		} catch (Exception e) {
			e.printStackTrace();
			TransactionTemplate.rollback();
		}
		return chooses;
	}

	@Override
	public void modfiyStudent(Student stu) {
		try {
			TransactionTemplate.beginTransaction();
			stuDao.updateStudent(stu);
			TransactionTemplate.commit();
		} catch (Exception e) {
			e.printStackTrace();
			TransactionTemplate.rollback();
		}
	}

}
